/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.workflow.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.hera.base.domain.BaseDomain;
import com.hera.process.security.domain.User;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "TASK_USER")
public class TaskUser  extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    //@Id
    //@Basic(optional = false)
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "TaskUser")
    @TableGenerator(name = "TaskUser", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_id", pkColumnValue = "TASKUSER", allocationSize = 1)
    @Column(name = "ID_TASK")
    private Long idTask;
    @JoinColumn(name = "ID_USER", referencedColumnName = "ID_USER")
    @ManyToOne
    private User user;
    @Column(name = "ID_STAGE")
    private Long idStage;
    @Column(name = "ID_STATUS")
    private Long idStatus;
    @Column(name = "ID_PROCESS_GROUP")
    private Long idProcessGroup;
    @Column(name = "ID_DEPARTMENT")
    private Long idDepartment;
    @Column(name = "ID_TIMEUNIT")
    private Long idTimeunit;
    @Column(name = "RESPONSE_TIME")
    private Double responseTime;
    @Column(name = "REQUESTED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date requestedDate;
    @Column(name = "RESPONSE_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date responseDate;
    @Column(name = "ATTENDED_USER")
    private Long attendedUser;
    @Column(name = "MAX_END_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date maxEndDate;
    private String name;
    @JoinColumn(name = "ID_PROCESS_INSTANCE", referencedColumnName = "ID_PROCESS_INSTANCE")
    @ManyToOne
    private ProcessInstance processInstance;
    @Column(name = "ID_EXT_REFERENCE")
    private Long idExtReference;

    public TaskUser() {
    }

    public TaskUser(Long idTask) {
        this.idTask = idTask;
    }

    public Long getIdTask() {
        return idTask;
    }

    public void setIdTask(Long idTask) {
        this.idTask = idTask;
    }

    public Long getIdStage() {
        return idStage;
    }

    public void setIdStage(Long idStage) {
        this.idStage = idStage;
    }

    public Long getIdStatus() {
        return idStatus;
    }

    public void setIdStatus(Long idStatus) {
        this.idStatus = idStatus;
    }

    public Long getIdProcessGroup() {
        return idProcessGroup;
    }

    public void setIdProcessGroup(Long idProcessGroup) {
        this.idProcessGroup = idProcessGroup;
    }

    public Long getIdDepartment() {
        return idDepartment;
    }

    public void setIdDepartment(Long idDepartment) {
        this.idDepartment = idDepartment;
    }

    public Long getIdTimeunit() {
        return idTimeunit;
    }

    public void setIdTimeunit(Long idTimeunit) {
        this.idTimeunit = idTimeunit;
    }

    public Double getResponseTime() {
        return responseTime;
    }

    public void setResponseTime(Double responseTime) {
        this.responseTime = responseTime;
    }

    public Date getRequestedDate() {
        return requestedDate;
    }

    public void setRequestedDate(Date requestedDate) {
        this.requestedDate = requestedDate;
    }

    public Date getResponseDate() {
        return responseDate;
    }

    public void setResponseDate(Date responseDate) {
        this.responseDate = responseDate;
    }

    public Long getAttendedUser() {
        return attendedUser;
    }

    public void setAttendedUser(Long attendedUser) {
        this.attendedUser = attendedUser;
    }

    public Date getMaxEndDate() {
        return maxEndDate;
    }

    public void setMaxEndDate(Date maxEndDate) {
        this.maxEndDate = maxEndDate;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ProcessInstance getProcessInstance() {
        return processInstance;
    }

    public void setProcessInstance(ProcessInstance processInstance) {
        this.processInstance = processInstance;
    }

    public Long getIdExtReference() {
		return idExtReference;
	}

	public void setIdExtReference(Long idExtReference) {
		this.idExtReference = idExtReference;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idTask != null ? idTask.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof TaskUser)) {
            return false;
        }
        TaskUser other = (TaskUser) object;
        if ((this.idTask == null && other.idTask != null) || (this.idTask != null && !this.idTask.equals(other.idTask))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.TaskUser[ idTask=" + idTask + " ]";
    }

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
    
}
